package com.wnxy.service.impl;

import com.wnxy.dao.IAuthDao;
import com.wnxy.domain.User;
import com.wnxy.service.IAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * @Classname AuthServiceImpl
 * @Description :
 * @Date 2021/2/23 18:20
 * @Created by Yeheng
 */
@Service
public class AuthServiceImpl implements IAuthService {
    @Autowired
    IAuthDao dao;

    public User findOne(User user) {
        Example<User> example = Example.of(user);
        Optional<User> one = dao.findOne(example);
        if (one.isPresent()){
            return one.get();
        }
        return null;
    }
}
